package static_;

/**
 * @Package: static_
 * @ClassName: CodeBlock
 * @Author: x2606
 * @CreateTime: 2022/3/10 20:17
 * @Description: 代码块
 */

public class CodeBlock {
    public static void main(String[] args) {
        Movie movie1 = new Movie("战狼");
        System.out.println(movie1.getName());

        Movie movie2 = new Movie("末代皇帝","20元");
        System.out.println(movie2.getName());
        System.out.println(movie2.getPrice());
    }
}

class Movie{
    private String name;
    private String price;
    private String direct;

    {
        System.out.println("屏幕点亮了");
        System.out.println("广告开始了");
        System.out.println("电影开始了");
    };

    public Movie(String name) {
        this.name = name;
    }

    public Movie(String name, String price) {
        this.name = name;
        this.price = price;
    }

    public Movie(String name, String price, String direct) {
        this.name = name;
        this.price = price;
        this.direct = direct;
    }

    public String getName() {
        return name;
    }

    public String getPrice() {
        return price;
    }

    public String getDirect() {
        return direct;
    }
}
